﻿<UserControl x:Class="UI.Web.SL.Demo.Modules.Customer.CustomerListView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:prism="http://www.codeplex.com/prism"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:commands="clr-namespace:UI.Web.SL.Demo.Infrastructure.Commands;assembly=UI.Web.SL.Demo.Infrastructure">
    
    <UserControl.Resources>
        <commands:ObservableCommand x:Key="DeleteCustomerCommand"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <!--<i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <i:InvokeCommandAction Command="{Binding PageLoadCommand}"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>-->
        <sdk:DataGrid AutoGenerateColumns="False" Name="dataGrid1" ItemsSource="{Binding Path=CustomerList}" Margin="5" IsReadOnly="True">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn Header="姓名" Binding="{Binding Path=NAME}" Width="100"/>
                <sdk:DataGridTextColumn Header="年龄" Binding="{Binding Path=AGE}" Width="100"/>
                <sdk:DataGridTemplateColumn Header="操作" Width="*">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <HyperlinkButton Content="删除" prism:Click.Command="{Binding Path=Value,Source={StaticResource DeleteCustomerCommand}}"
                                             prism:Click.CommandParameter="{Binding BindsDirectlyToSource=True}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>
</UserControl>
